home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
366_01
/
ue311c1.arc
/
AOSVS.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-11
|
56KB
|
1,925 lines
/*
* aosvs.c - AOS/VS & MV/UX version of the termio.c module
*
* The functions in this module deal with the O/S in reading/writing
* characters from/to the screen. We also deal with various wiedness things
* in dealing with the AOS/VS file system such as ACL's and elementsizes.
* This has been written primarily for AOS/VS but should work for MV/UX as
* well. No promises though.
*
* AOS/VS and MV/UX are products of Data General Corporation, Westboro MA.
*
* Authors:
* Daniel Lawrence --- doing MicroEmacs... stuff copied into here...
* Douglas Rady ------ most of the rest of the stuff here
* Credits:
* Michael Meissner -- beating Doug over the head with advice and info.
* on AOS/VS "C" compiler. THANK YOU!!!!!!!!!!
* Bill Benedetto
* & friends ---- beta victims, bug finders/fixers
* GNU --------------- inspiration, software tools, clean readable BSD
* and USG code examples and interesting comments.
*
* Definition: uka = Unixly Known As
*
* Revision/Hack History
* MicroEMACS v3.<9p,10> AOS/VS History
*
* 3.09.16.00 - 3.09.16.09 ??-???-?? dcr
* Before written history. Suffice to say that .00 - .04 was just the
* AOS/VS port from 3.8z, 3.9e, 3.9i and 3.9n with major cleaning up and
* rewriting of the AOS/VS stuff. Sub-revisions 3.09.16.05 - 3.09.16.09
* being optimizations and various fixes.
* Yawn...
*
* 3.09.16.10 25-Aug-88 dcr
* Changed do_system_end() in aosvs.c to check for execution of a
* macro as basis for not executing an mlreply("Continue") call.
* Also fixed stime() in aosvs.c so it just plain worked.
* #$&^@*&(+$#!!!!
* Also added REPLYNL in estruct.h and made use of CR or NL in the
* mlreply() routine in input.c compile time conditional.
*
* 3.09.16.11 13-Sep-88 dcr
* Start of written hisory. This is a momentous event in the course of
* AOS/VS MicroEMACS history: doug writes some change doc.!!! Yeah!!!
* Changed several functions to force the $builtin version as a trade of
* more code size for more speed (usually defaulted to $builtin anyway...).
*
* 3.09.16.12 14-Sep-88 dcr
* Recompiled with revision 4.00 of AOS/VS C. A miracle...
*
* 3.09.16.13 12-Oct-88 dcr
* Changed to have the temporary file for pipecmd() be created in a system
* wide temporary file directory known as :TMP, uka /tmp. You paranoids
* can create :TMP as a CPD with max. size of 2048 blocks and an ACL of
* +,WE and you should be able to relax a nibble.
* Creates temp. file with ACL of username,OWAR
*
* 3.09.16.14 13-Oct-88 dcr
* Put in MCA's hack to reduce memory consumption when VIEWing a file.
* Modified lalloc() in line.c Test case of paru.h saved 27 2Kb pages.
*
* 3.10.00.00 09-Nov-88 dcr
* Begin code porting for 3.10 BETA.
*
* 3.10.00.01 20-Dec-88 dcr
* Implemented multi-language messages in aosvs.c per 3.10 BETA.
*
* 3.10.00.02 26-Dec-88 dcr
* Tracked down some un-documented runtime optimizations and got
* a working version. Also resolved timeset() references.
*
* 3.10.00.03 17-Jan-89 dcr
* Cleaned up for shipping to Dan. Put in some missing code for input.c
*
* 3.10.00.04 17-Jan-89 dcr
* Put in some optimizations regarding TTflush() and ostring() in the
* bind.c, input.c and aosvs.c files. This freed 2Kb... but not for long.
*
* 3.10.00.05 17-Jan-89 dcr
* Some memory optimization in exec.c and input.c for small regain.
*
* 3.10.00.06 - 3.10.00.27 02-Mar-89 - 10-Mar-89 dcr
* Various changes. Cleaned up the AOS/VS changes in other modules so
* we actually work right. Added conditionals for using either BSD or
* USG console i/o (BSD doesn't seem to work). Reclaimed about 4Kb of
* memory in various places and made some of these optimizations compile
* time conditional. We are still using .890+ ms to start up intead of the
* .520+ ms that we took with 3.9p. Not much hope there... but...
* Various tweaks here and there. Added the skip of nulls when reading in
* a file (most unpleasant results if we don't). Lost some memory to the
* USG console i/o stuff. Threw out the BSD console i/o stuff, sigh....
*
* 3.10.00.28 10-Mar-89 dcr
* Stuck in the aosvs$unix_to_aosvs_path() routine to replace the code
* in resolve_pathname(). The new routine does a fairly complete job of
* converting Unix(tm) pathnames to AOS/VS format. It also handles the
* Ms-Dog '\' path seperator.
*
* 3.10.00.29 16-Mar-89 dcr
* Changed pathname expansion to be invisible to user. Required changes
* to fileio.c to #if AOSVS replace the fopen() calls with our xxfopen()
* call which does the pathname expansion. Allowed removal of all the
* related to the EXPPATH define. Also changed several routines here.
* Allows user to reference buffer & file names w/o "unexpanding" the
* orginal pathname.
* Diff'd & sent to Dan.
*
*/
#nolist
#include <stdio.h> /* get the usual */
#list
#include "estruct.h" /* get the MicroEMACS stuff */
#ifdef AOSVS | MV_UX /* should this be done? */
#define dashertermdef 1 /* might not be used any more */
#nolist
#include "edef.h" /* get the MicroEMACS extern's */
#include "elang.h"
#list
/* There is no kitchen sink in C so we can't include it. Maybe in C++... */
#nolist
#include <paru.h> /* AOS/VS system mnemonics */
#include <sysid.h> /* AOS/VS system call mnemonics */
#include <packets/characteristics.h> /* sys call packet for terminal char.*/
#include <packets/create.h> /* sys call packet to create files */
#include <packets/filestatus.h> /* sys call packet to get file info */
#include <packets/misc.h> /* misc. sys call packets (?SYSPRV) */
/* And now... the Unix(tm) stuff... */
#include <fcntl.h> /* terminal file control stuff */
#include <signal.h> /* the signals... */
#include <termio.h> /* more terminal control stuff */
#list
/*
Variables!!! Functions!!! Externals!!!!
*/
struct termio old_in_termio; /* original stdin terminal characteristics */
struct termio new_in_termio; /* stdin characteristics to use inside */
int kbdpoll; /* type ahead polling flag */
int kbdflgs; /* saved keyboard fd flags */
int kbdqp; /* there is a char in kbdq */
char kbdq; /* char we've already read */
/*
some D.G. supplied AOS/VS & MV/UX specific functions
_toaos_fid() - changes UNIX(tm) pathname to AOS/VS pathname (Thank you!)
traceback() - calls the ?SNAP LANG_RT routine for error traceback
*/
/*extern int _toaos_fid(char*, char* );*/
extern VOID traceback(int );
/*
This is how we make an MV/Eclipse accumulator in C with almost all options.
*/
union accumulator { /* dearly beloved, we are gathered here...*/
unsigned long * ptr; /* pointer to unsigned long (generic) */
char * cptr; /* pointer to char */
unsigned int * pint; /* pointer to unsigned int */
unsigned short *psht; /* pointer to short */
unsigned long ulng; /* unsigned lon